using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLBH
{
public class tblChamCongUI
{ 
	private int idChamCong;
	public int IdChamCong
	{
		get { return idChamCong;}
		set { idChamCong = value;}
	}

	private int idCaLamViec;
	public int IdCaLamViec
	{
		get { return idCaLamViec;}
		set { idCaLamViec = value;}
	}

	private int idNguoiDung;
	public int IdNguoiDung
	{
		get { return idNguoiDung;}
		set { idNguoiDung = value;}
	}

	private byte trangThai;
	public byte TrangThai
	{
		get { return trangThai;}
		set { trangThai = value;}
	}

	private int thoiGianDenMuon;
	public int ThoiGianDenMuon
	{
		get { return thoiGianDenMuon;}
		set { thoiGianDenMuon = value;}
	}

	private DateTime ngayLamViec;
	public DateTime NgayLamViec
	{
		get { return ngayLamViec;}
		set { ngayLamViec = value;}
	}

	public tblChamCongUI() {}

	public tblChamCongUI(int idChamCong, int idCaLamViec, int idNguoiDung, byte trangThai, int thoiGianDenMuon, DateTime ngayLamViec)
	 {
		this.idChamCong = idChamCong;
 		this.idCaLamViec = idCaLamViec;
 		this.idNguoiDung = idNguoiDung;
 		this.trangThai = trangThai;
 		this.thoiGianDenMuon = thoiGianDenMuon;
 		this.ngayLamViec = ngayLamViec;
 	}

	public int Add(int idCaLamViec, int idNguoiDung, byte trangThai, int thoiGianDenMuon, DateTime ngayLamViec)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblChamCong_Add",idCaLamViec,idNguoiDung,trangThai,thoiGianDenMuon,ngayLamViec);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idChamCong, int idCaLamViec, int idNguoiDung, byte trangThai, int thoiGianDenMuon, DateTime ngayLamViec)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblChamCong_Update",idChamCong,idCaLamViec,idNguoiDung,trangThai,thoiGianDenMuon,ngayLamViec);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idChamCong)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblChamCong_Delete",idChamCong);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblChamCong_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idChamCong)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblChamCong_Get",idChamCong);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblChamCong_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetByIdCaLamViec(int idCaLamViec)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblChamCong_GetByIdCaLamViec",idCaLamViec);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetByIdNguoiDung(int idNguoiDung)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblChamCong_GetByIdNguoiDung",idNguoiDung);
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
